var express = require('express')
var bodyParser = require('body-parser')
var fs = require('fs')
var path = require('path')
var router = require('./router')
var app = express()

app.use('/public', express.static(path.join(__dirname,'./public')))

app.engine('html',require('express-art-template'))
app.set('views',path.join(__dirname,'/views')) //默认是views目录

// 在挂载路由前配置
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())

// 挂载路由
app.use(router)

app.listen(5000,()=>{
    console.log('http://127.0.0.1:5000')
    // console.log(__dirname)
    // console.log(__filename)
})